import uuid
from django.db import models

# Create your models here.

# 文件夹
class FolderModel(models.Model):
    uuid = models.UUIDField(primary_key=True,default=uuid.uuid4(),editable=False)
    name = models.CharField(max_length=100)
    super = models.ForeignKey("file.FolderModel",on_delete=models.CASCADE)
    create_user = models.ForeignKey("org.UserModel",on_delete=models.CASCADE)
    class Meta:
        db_table = "pj_folder"

# 文件
class FileModel(models.Model):
    uuid = models.UUIDField(primary_key=True,default=uuid.uuid4(),editable=False)
    name = models.CharField(max_length=300)
    folder = models.ForeignKey(FolderModel,on_delete=models.SET_NULL,null=True,blank=True)
    size = models.BigIntegerField()
    create_time = models.DateTimeField(auto_now_add=True)
    create_user = models.ForeignKey("org.UserModel",on_delete=models.SET_NULL,null=True,blank=True)
    cls_choise = [
        (1,"文本"),
        (2, "表格"),
        (3, "演示稿"),
        (4,"图片"),
        (5,"视频"),
        (6,"其它")
    ]
    cls = models.CharField(max_length=1,choices=cls_choise)
    class Meta:
        db_table = "pj_file"
